import upload from '@/utils/upload'
import request from '@/utils/request'

// 创建ERP 随货同行单
export function createSupplierSendOrder(data) {
  return request({
    url: '/erp/supplier-send-order/create',
    method: 'post',
    data: data
  })
}

// 更新ERP 随货同行单
export function updateSupplierSendOrder(data) {
  return request({
    url: '/erp/supplier-send-order/update',
    method: 'put',
    data: data
  })
}

// 删除ERP 随货同行单
export function deleteSupplierSendOrder(id) {
  return request({
    url: '/erp/supplier-send-order/delete?id=' + id,
    method: 'delete'
  })
}

// 获得ERP 随货同行单
export function getSupplierSendOrder(id) {
  return request({
    url: '/erp/supplier-send-order/get?id=' + id,
    method: 'get'
  })
}

// 根据科室，id查询 随货同行单
export function getSupplierSendOrderByDepartmentId(id) {
  return request({
    url: '/erp/supplier-send-order/getSupplierSendOrderByDepartmentId?id=' + id,
    method: 'get'
  })
}

// 获得ERP 随货同行单分页
export function getSupplierSendOrderPage(params) {
  return request({
    url: '/erp/supplier-send-order/page',
    method: 'get',
    params
  })
}
// 导出ERP 随货同行单 Excel
export function exportSupplierSendOrderExcel(params) {
  return request({
    url: '/erp/supplier-send-order/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// ==================== 子表（ERP 随货同行单项） ====================
      // 获得ERP 随货同行单项列表
    export function getSupplierSendOrderItemListByOutOrderId(outOrderId) {
      return request({
        url: '/erp/supplier-send-order/supplier-send-order-item/list-by-out-order-id?outOrderId=' + outOrderId,
        method: 'get'
      })
    }
  